class RunningIssueNode extends MyNode{
    constructor($state='new',...obj){
        super('RunningIssue',$state,{
            suggest:"正常运行"
        },...obj);
    }

    getText(){
        return `运行建议：${this.suggest}`;
    }

    getTemplate(edge,g){
        return `
 <div class="form-group">
    <label class="col-sm-2 control-label">运行建议</label>
    <div class="col-sm-10">
         <select class="form-control" data-ng-model="graph.getNode('${this.id}').suggest"
         data-ng-options="x for x in ['正常运行','监视运行','紧急停机']"
         data-ng-init="graph.getNode('${this.id}').suggest = '${this.suggest}'"
         ></select>
    </div>
 </div>
  <div class="form-group">
 <label class="col-sm-2 control-label">操作</label>
 <p class="col-sm-10 form-control-static">
      <a class="button btn" data-ng-if="allowFeature('${this.id}')" data-ng-click="attachFeature('${this.id}')">添加特征</a>
     <a class="button btn" data-ng-if="allowFeature('${this.id}')" data-ng-click="attachGroup('${this.id}','FeatureGroup')">添加特征组</a>
     <a class="button btn" data-ng-if="allowFeature('${this.id}')" data-ng-click="attachExternalFeature('${this.id}')">添加已存在特征</a>
     <a class="button btn" data-ng-if="allowFeature('${this.id}')" data-ng-click="attachExternalGroup('${this.id}','FeatureGroup')">添加已存在特征组</a>
    <a class="btn" href="javascript:;" ng-click="removeEdge(${edge})">删除当前节点</a>
 </p>
</div>
`;
    }

    getReadonlyTemplate(edge,g){
        return `
 <div class="form-group">
    <label class="col-sm-2 control-label">运行建议</label>
    <p class="col-sm-10 form-control-static">${this.suggest}</p>
 </div>
 `
    }
}

RunningIssueNode.items = ['正常运行','监视运行','紧急停机'];
RunningIssueNode.asInt = function (str) {
  // if (str instanceof RunningIssueNode){
  //     str = str.suggest;
  // }
  return RunningIssueNode.items.indexOf(str);
};

RunningIssueNode.asString = function (index) {
  return RunningIssueNode.items[index];
};
